//
//  BillManagerCell.m
//  HuaMuJinRong
//
//  Created by 吴建东 on 16/4/21.
//  Copyright © 2016年 EIMS. All rights reserved.
//

#import "BillManagerCell.h"

@interface BillManagerCell ()
{
    BillManagerModel *_model;
}
@end

@implementation BillManagerCell

- (void)refreshCellWithModel:(BillManagerModel *)model {
    
    _model = model;
    
    _typeImageView.image = KDefaultImage;
    _nameLabel.text = model.summary;
    _timeLabel.text = model.Time;
    if (model.type==1 || model.type==4) {
        _moneyLabel.text = [NSString stringWithFormat:@"+%.2f",model.amount];
        _moneyLabel.textColor = KColor;
    } else if (model.type==2 || model.type==3)  {
        _moneyLabel.text = [NSString stringWithFormat:@"-%.2f",model.amount];
        _moneyLabel.textColor = GreenColor;
    } else {
        _moneyLabel.text = @"0";
        _moneyLabel.textColor = GreenColor;
    }
    if (model.operation==1 || model.operation==2 || model.operation==3 || model.operation==320) {
        _typeImageView.image = [UIImage imageNamed:@"trade_recharge"];
    }else if (model.operation == 4 || model.operation==325) {
        _typeImageView.image = [UIImage imageNamed:@"trade_jiang"];
    }else if (model.operation==8 || model.operation==9 || model.operation==13 || model.operation==311 || model.operation==312) {
        _typeImageView.image = [UIImage imageNamed:@"trade_huan"];
    }else if (model.operation==14 || model.operation==303 || model.operation==201) {
        _typeImageView.image = [UIImage imageNamed:@"trade_withdraw"];
    }else if (model.operation == 11) {
        _typeImageView.image = [UIImage imageNamed:@"trade_fee"];
    }else if (model.operation==503 || model.operation==502 || model.operation==501) {
        _typeImageView.image = [UIImage imageNamed:@"trade_sqb"];
    }else if (model.operation==403 || model.operation==402 || model.operation==401) {
        _typeImageView.image = [UIImage imageNamed:@"trade_regular"];
    }else {
        _typeImageView.image = [UIImage imageNamed:@"trade_other"];
    }
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    
}

- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
    
    _nameLabel.font = KFontSize(14);
    _timeLabel.font = KFontSize(12);
    _moneyLabel.font = KFontSize(14);
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
